<?php
class Zendvn_View_Helper_NewPosts extends Zend_View_Helper_Abstract{
	
	public function getPosts() {
		$procduct= new Default_Model_DbTable_Posts();
		return $procduct->getPostsNew();
	}
	
	public function newPosts()
	{
		
		$html='<table width="184" border="0" cellpadding="0" cellspacing="0" id="table">
		  <tr>
		    <td><img src="'.$this->view->imgUrl.'/New_posts.jpg" width="176" height="38" /></td>
		  </tr>
		  <tr>
		 	<td id="infotable">';
		    
				foreach ($this->getPosts() as  $value) {
			
				    $html.='<table width="100%" border="0" cellspacing="0" cellpadding="2"  >
				    
				      <tr>
				        <td colspan="2" >
				        <a href="'.$this->view->url(array("controller"=>"posts","action"=>"view","id"=>$value['id']),null,true).'">'.
				    nl2br(substr( strip_tags( $value['Title']), 0 , 25)).'</a></td>
				        </tr>
				    </table>';    
			    }
			$html.=' </td>
		</tr>
	</table><br />';
	   return $html;
	}
}